package hredis

import (
	_ "github.com/gogf/gf/contrib/nosql/redis/v2"
	"github.com/gogf/gf/v2/database/gredis"
)

var (
	RedisDB *gredis.Redis
)

func InitRedisDB() (err error) {

	var (
		redis_host     = "xxxx"
		redis_password = "xxxx"
		redis_port     = "xxxx"
		redis_db       = 0
	)

	config := &gredis.Config{
		Address: redis_host + ":" + redis_port,
		Db:      redis_db,
		Pass:    redis_password,
	}

	// 实例化
	RedisDB, err = gredis.New(config)
	if err != nil {
		panic(err)
	}

	return

}
